Skip to content

api/password end point added for reseting password which uses api/pas… #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

danishjamal104
Copy link
Member

@danishjamal104 danishjamal104 commented Sep 20, 2020

New End Point

Implements the password reset workflow.

  • api/password/forget -> generates a new token and sets expiry and sends the user an email by visiting which he can reset his passwrod
  • api/password/reset -> takes new password and check if token is valid and updates the password.

api/password/forget

{
    "email": "[email protected]"
}

api/password/reset

{
    "email": "[email protected]",
    "token": "token viz send to users email",
    "password": "new password"
}

Changes

  1. Added new field in the user model named resetInfo
    •  "token": "token viz used for verification",
       "expiry": "date obj which tells when this token is expired"
  2. New file routes/reset.js viz contains two routes
    • /forget
    • /reset
  3. Updated doc
  4. Added new package crypto viz used to generate new token refer line 44 in routes/reset.js
  5. Added new package nodemailer viz used for sending emails.

…sword/forget to generate request and uses api/password/reset for setting new password
Copy link
Member

@Isha2103 Isha2103 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In src/app.js, line no. 22 missing semi-colon at last.
In src/docs/index.html, line number 44 Spelling error in password.

@lazycipher
Copy link
Member

@danishjamal104, how are you checking/making sure if a token expired when a user tries to use an expired token?

@mohdorusaid
Copy link
Contributor

Issue with comment on forget endpoint, check that out

@danishjamal104
Copy link
Member Author

@danishjamal104, how are you checking/making sure if a token expired when a user tries to use an expired token?

file reset.js line 113

@lazycipher
Copy link
Member

@danishjamal104, Email verification was added in the development branch which uses a feature of mongo maybe have a look!

Copy link
Member

@Isha2103 Isha2103 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good to go!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants